package com.keshan.config;

import com.keshan.interceptors.JWTInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author keshan
 * @date 2022/11/6 - 18:04
 */
@Configuration
@MapperScan(value = "com.keshan.mapper")
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
                .addPathPatterns("/bloodoxygen/bloodoxygenlisthidetoday")
                .addPathPatterns("/bloodoxygen/bloodoxygenlistdayavg")
                .addPathPatterns("/bloodpressure/bloodpressurelisthidetoday")
                .addPathPatterns("/bloodpressure/bloodpressurelistdayavg")
                .addPathPatterns("/heartrate/heartratelisthidetoday")
                .addPathPatterns("/heartrate/heartratelistdayavg")
                .addPathPatterns("/mduser/updateRealName")
                .addPathPatterns("/mduser/bondDevice")
                .addPathPatterns("/mduser/test")
                .addPathPatterns("/multiclass/multiclasslisthidetoday")
                .addPathPatterns("/sleep/sleeplisteveryday")
                .addPathPatterns("/sleep/sleeplisthidetoday")
                .addPathPatterns("/stepcount/stepcountlisteveryday")
                .addPathPatterns("/stepcount/stepcountlisthidetoday")
                .addPathPatterns("/pushHistory/list")
                .addPathPatterns("/pushHistory/selectById")
                .excludePathPatterns("/mduser/login")
                .excludePathPatterns("/mduser/register")
                .excludePathPatterns("/wx/login");
    }
}
